package com.qiyuesuo.service.impl;

import com.qiyuesuo.dao.UserDao;
import com.qiyuesuo.model.User;
import com.qiyuesuo.service.UserService;
import com.qiyuesuo.untils.MD5Untils;
import net.qiyuesuo.framework.service.BaseCrudService;
import net.qiyuesuo.rpc.annotation.RpcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import sun.security.provider.MD5;

import java.util.Date;

@RpcService
@Transactional
public class UserServiceImpl extends BaseCrudService<User> implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public void insertUser(User user) {
        user.setPassword(MD5Untils.getSign(user.getPassword()));
        user.setCreated(new Date());
        //默认注册是没有进行签协议的
        user.setStatus(0);
        userDao.insert(user);
    }
}
